<?php /* Smarty version Smarty-3.1.6, created on 2018-03-10 22:59:49
         compiled from "./Tpl/Admin\SysRole\access.html" */ ?>
<?php /*%%SmartyHeaderCode:80725aa3f2e5278d06-79198868%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '1b7431b77a3bd09bc5194989f72570d9524cf071' => 
    array (
      0 => './Tpl/Admin\\SysRole\\access.html',
      1 => 1494558134,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '80725aa3f2e5278d06-79198868',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'preStaticUrl' => 0,
    'role' => 0,
    'module_level_1' => 0,
    'module_level_1_shop' => 0,
    'module_level_2' => 0,
    'l2' => 0,
    'l3' => 0,
    'module_level_2_shop' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.6',
  'unifunc' => 'content_5aa3f2e531510',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5aa3f2e531510')) {function content_5aa3f2e531510($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ("Public/top.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

<!-- <link media="screen" rel="stylesheet" href="<?php echo $_smarty_tpl->tpl_vars['preStaticUrl']->value;?>
/Css/colorbox/colorbox.css" />
<script src="<?php echo $_smarty_tpl->tpl_vars['preStaticUrl']->value;?>
/Js/jquery.colorbox-min.js"></script> -->
<script>

// $(document).ready(function(){
// 	$("#access").colorbox();
// })

//    $(document).ready(function(){
//        $('.check-all-box').on('ifClicked', function(event){
//            var parent_box = $(this);
//            var children_box = $(this).parent().parent().next().find('input');
//            children_box.each(function(){
//                if(parent_box.prop("checked") == true){
//                    $(this).iCheck('uncheck');
//                }else{
//                   $(this).iCheck('check');
//                }
//            });
//        });
        // $('.checkbox-item').on('ifChecked', function(event){
        //     var parent_id = $(this).data('parent');
        //     console.log(parent_id);
        // });
//    });

</script>
</head>
<body>
    <div id="warpper">
        <div class="content">
            <div class="location">角色管理</div>
            <div class="ui-tab">
                <ul>
                    <li class="tab-item"><a href="<?php echo U('SysRole/index');?>
" onclick="LayerShow();">角色列表</a></li>
                    <li class="tab-item"><a href="<?php echo U('SysRole/add');?>
" onclick="LayerShow();">新增角色</a></li>
                    <li class="tab-item last-item selected"><a href="javascript:void(0);">权限分配</a></li>
                </ul>
            </div>
            <div class="topic">权限分配</div>
            <form action="<?php echo u('SysRole/accessUpdate');?>
" class="ui-form" id="addManagerForm" method="post">
                <input type="hidden" name="id" value="<?php echo $_smarty_tpl->tpl_vars['role']->value['id'];?>
" />
                <!--level=1 默认被选中-->
                <!--<input type="checkbox" name="access[]" value="<?php echo $_smarty_tpl->tpl_vars['module_level_1']->value['id'];?>
">-->
                <input type="hidden" name="access[]" value="<?php echo $_smarty_tpl->tpl_vars['module_level_1']->value['id'];?>
">
                <input type="hidden" name="access[]" value="<?php echo $_smarty_tpl->tpl_vars['module_level_1_shop']->value['id'];?>
">
                <div class="form-box border0 border-box">
                    <p>超级管理员后台</p>

                    <?php  $_smarty_tpl->tpl_vars["l2"] = new Smarty_Variable; $_smarty_tpl->tpl_vars["l2"]->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['module_level_2']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars["l2"]->key => $_smarty_tpl->tpl_vars["l2"]->value){
$_smarty_tpl->tpl_vars["l2"]->_loop = true;
?>
                        <div class="ui-form-item">
                            <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['l2']->value['id'];?>
" name="access[]">
                            <div style="float:left">
                                <label class="ui-label"><?php echo $_smarty_tpl->tpl_vars['l2']->value['title'];?>
</label>
                                <label>全选</label>
                                <input type="checkbox"  class="check-all-box" checked="checked" />
                            </div>
                            <span class="ui-field" style="width:38%; text-align:left;">
                                <?php  $_smarty_tpl->tpl_vars["l3"] = new Smarty_Variable; $_smarty_tpl->tpl_vars["l3"]->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['l2']->value['sub']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars["l3"]->key => $_smarty_tpl->tpl_vars["l3"]->value){
$_smarty_tpl->tpl_vars["l3"]->_loop = true;
?>
                                <div class="list-checkbox">
                                <input <?php if ($_smarty_tpl->tpl_vars['l3']->value['checked']==1){?> checked <?php }?> value="<?php echo $_smarty_tpl->tpl_vars['l3']->value['id'];?>
" type="checkbox" name="access[]" class="checkbox-item" data-parent="<?php echo $_smarty_tpl->tpl_vars['l2']->value['id'];?>
"><label>&nbsp;&nbsp;<?php echo $_smarty_tpl->tpl_vars['l3']->value['title'];?>
</label>
                                </div>
                                <?php } ?>
                            </span>
                        </div>
                    <?php } ?>
                </div>
                <div class="form-box border0 border-box">
                    <p>商户管理</p>

                    <?php  $_smarty_tpl->tpl_vars["l2"] = new Smarty_Variable; $_smarty_tpl->tpl_vars["l2"]->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['module_level_2_shop']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars["l2"]->key => $_smarty_tpl->tpl_vars["l2"]->value){
$_smarty_tpl->tpl_vars["l2"]->_loop = true;
?>
                    <div class="ui-form-item">
                        <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['l2']->value['id'];?>
" name="access[]">
                        <div style="float:left">
                        <label class="ui-label"><?php echo $_smarty_tpl->tpl_vars['l2']->value['title'];?>
</label>
                        <label>全选</label>
                        <input type="checkbox"  class="check-all-box" checked="checked" />
                            </div>
                            <span class="ui-field" style="width:38%; text-align:left;">
                                <?php  $_smarty_tpl->tpl_vars["l3"] = new Smarty_Variable; $_smarty_tpl->tpl_vars["l3"]->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['l2']->value['sub']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars["l3"]->key => $_smarty_tpl->tpl_vars["l3"]->value){
$_smarty_tpl->tpl_vars["l3"]->_loop = true;
?>
                                <div class="list-checkbox">
                                    <input <?php if ($_smarty_tpl->tpl_vars['l3']->value['checked']==1){?> checked <?php }?> value="<?php echo $_smarty_tpl->tpl_vars['l3']->value['id'];?>
" type="checkbox" name="access[]" class="checkbox-item" data-parent="<?php echo $_smarty_tpl->tpl_vars['l2']->value['id'];?>
"><label>&nbsp;&nbsp;<?php echo $_smarty_tpl->tpl_vars['l3']->value['title'];?>
</label>
                                </div>
                                <?php } ?>
                            </span>
                    </div>
                    <?php } ?>
                </div>
                <div class="integral_btn-group">
                    <input type="button" value="提交编辑" id="submit" onfocus="blur();" onclick="LayerShow();" class="ui-button"/>
                </div>
            </form>
        </div>
    </div>
<?php echo $_smarty_tpl->getSubTemplate ("Public/foot.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

<script>
    $("#submit").on('click',function () {
        var param = $("#addManagerForm").serialize();
       $.post("<?php echo u('SysRole/accessUpdate');?>
",param,function (res) {
           parent.closeLoading();
           layer.msg(res.msg);
           if(res.status == 0){
               location.reload();
           }
       });
    });
</script><?php }} ?>